'use strict'


import Http from '../kit/HttpKit'
import Api from './Api'

const URL_LIST = Api.API_URL + '/product/list'
const URL_DELETE = Api.API_URL + '/product/delete'
const URL_DETAIL = Api.API_URL + '/product/detail'
const URL_CHECK_STATUS_PASS = Api.API_URL + '/product/checkStatusPass'
const URL_CHECK_STATUS_FAIL = Api.API_URL + '/product/checkStatusFail'

/**
* 商品列表
**/
const list = (data, callback)=>{
	data.api_token = Api.getApiToken();
	data.api_user_id = Api.getApiUserId();
	Http.post(URL_LIST, data, json=>{
		Api.getDataCB(json, callback);
	});
}

/**
 * 商品详情
 **/
const detail = (productId, callback)=>{
	let data = {id: productId};
	data.api_token = Api.getApiToken();
	data.api_user_id = Api.getApiUserId();

	Http.post(URL_DETAIL, data, json=>{
		Api.getDataCB(json, callback);
	});
}

export default{
	list, detail,
	URL_LIST, URL_DELETE, URL_CHECK_STATUS_PASS, URL_CHECK_STATUS_FAIL
}
